package com.holly.unit.bpmn.designer.enums;

import java.util.Objects;
import java.util.stream.Stream;

/**
 * 类描述: 审批超时时间单位 枚举类
 *
 * @author fxr
 * @version 1.0.0
 * @date 2022/5/7 9:54
 */
public enum TimeLimitTypeEnum {

    // 天
    DAY("DAY"),
    // 小时
    HOUR("HOUR");

    String fieldName;

    TimeLimitTypeEnum(String fieldName) {
        this.fieldName = fieldName;
    }

    public String fieldName() {
        return this.fieldName;
    }

    public static TimeLimitTypeEnum of(String fieldName) {
        return Stream.of(TimeLimitTypeEnum.values())
                .filter(clazz -> Objects.equals(clazz.fieldName(), fieldName))
                .findFirst()
                .orElse(DAY);
    }


}
